﻿using Microsoft.CodeAnalysis;

namespace UIOC.CodeAnalysis.Diagnostics;

internal static class InstantiationDiagnostic {

    public const string DiagnosticId = "UIOC0022";

    private const string Title = "实例化分析";
    private const string MessageFormat = "类型 '{0}' 实现了接口 'UIOC.IObject' 不能使用 'new' 关键字实例化，请改用 'UIOC.Application.TypeMap.Instantiate() 获取实例'";
    private const string Description = "’UIOC‘ 对象需要使用 ‘UIOC.Application.TypeMap.Instantiate’ 方法进行实例化";
    private const string Category = "Usage";

    public static readonly DiagnosticDescriptor Rule = new(
        DiagnosticId,
        Title,
        MessageFormat,
        Category,
        DiagnosticSeverity.Error,
        isEnabledByDefault: true,
        description: Description
    );
}
